package com.ten.shou.controller;

import com.ten.common.core.entity.EduCourse;
import com.ten.common.core.entity.EduSubject;
import com.ten.common.core.vo.Result;
import com.ten.shou.feign.CourseListFeign;
import com.ten.shou.service.*;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：杨（1964958771@qq.com）
 * @date ：Created in 2022/12/22 17:35
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("home/qian")
@Api(tags = "前台首页接口")
public class QianHomeController {
    @Resource
    private BottomService bottomService;
    @Resource
    private HeadService headService;
    @Resource
    private BannerService bannerService;
    @Resource
    private LinkService linkService;
    @Resource
    private CourseListFeign courseListFeign;
    @Resource
    private ZoneService zoneService;

    @GetMapping("/banner/getQianBanner")
    public Result getQianBanner() {
        return bannerService.getQianBanner();
    }

    @GetMapping("bottomArticle/getQianAllBottomArticle")
    public Result getQianAllBottomArticle() {
        return bottomService.getQianAllBottomArticle();
    }

    @GetMapping("head/getAllHead")
    public Result getAllHead() {
        return headService.getAllHead();
    }

    @GetMapping("link/getQianLink")
    public Result getQianLink() {
        return linkService.getQianLink();
    }

    @GetMapping("zone/getAllQianMenu")
    public Result getAllQianMenu() {
        Result<List<EduSubject>> subjectByStatus = courseListFeign.findSubjectByStatus();
        List<EduSubject> records = subjectByStatus.getData();
        return new Result(200, "查询首页课程分类成功", records);

    }

    @GetMapping("zone/getAllQianZone")
    public Result<List<EduCourse>> getAllQianZone() {
        return zoneService.getAllQianZone();
    }

    @PostMapping("/article/getAllQianArticle/{id}")
    public Result getAllQianArticle(@PathVariable String id) {
        return bottomService.getAllQianArticle(id);
    }


}
